package com.forekenow.Demo8;

import com.forekenow.Demo4.Test;
import sun.font.DelegatingShape;

public class TestMethod {
    public void m1(int a){
        System.out.println(a);
    }
    public int m2(){
        return 12;
    }
//方法的参数可以作为用户的输入
    public void m3(String email){
        System.out.println(email);
    }

    public String m4(){
        return "张三";
    }

    public void m5(int[] a){
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
        }
    }
    public int[] m6(int[] a){
        return a;
    }


    public void m7(Student student){
        System.out.println(student.getId()+"----"+student.getName()+"----"+student.getAge());
    }

    public Student m8(Student student1){

        return student1;
    }

    public boolean m9(A a,String username,String password){
        boolean isRight = a.login(username,password);
       return isRight;
    }

    public int m10(X x,Student s){
        return x.add(s);
    }
    public X m11(X a){
        return a;
    }

    public Student[] m12(Student[] stu ){
        return stu;
    }

    public static void main(String[] args) {
        TestMethod method = new TestMethod();
        Student s2 = new Student();
        s2.setId(1005);
        s2.setAge(6);
        s2.setName("dsaf");
        Student s1 = new Student();
        s1.setId(1004);
        s1.setAge(5);
        s1.setName("笑话");
        Student[] students = new Student[2];
        students[0]=s2;
        students[1]=s1;
        Student[] ss = method.m12(students);
        for (int i = 0; i < ss.length; i++) {
           Student stu = ss[i];
            System.out.println(stu.getName());
        }


        X a = new XImpl();
        X xx = method.m11(a);
        xx.add(new Student());
        System.out.println();


        X x = new XImpl();                      //接口new实现类对象
        Student s = new Student();
        s.setId(1004);
        s.setAge(5);
        s.setName("笑话");
        int i = method.m10(x,s);
        if (i==1){
            System.out.println("添加成功");
        }else {
            System.out.println("添加失败");
        }



        B b  = new B();
        boolean isRight = method.m9(b,"tom","123456");
        if (isRight){
            System.out.println("success");
        }else {
            System.out.println("no");
        }

        int[] array = new int[]{1,2,3,2,5};
        int[] result = method.m6(array);
        for (int i1 = 0; i1 < result.length; i1++) {
            System.out.println(result[i1]);
        }

        Student student = new Student();
        student.setId(1004);
        student.setAge(5);
        student.setName("笑话");
        method.m7(student);

        Student student1 = new Student();
        student1.setId(100600604);
        student1.setAge(5);
        student1.setName("是的");
        method.m8(student1);
        System.out.println(student1.getId()+"-----"+student1.getAge()+"-----"+student1.getName());


//        method.m5(array);
//        method.m1(12);
//        int num = method.m2();
//        System.out.println(num);
//        method.m3("1336042995@qq.com");
//        String name = method.m4();
//        System.out.println(name);
    }
}
